function focusInput(input)
{
	DOM.firstChild(DOM.prev(input.parentNode, "TD"), 'INPUT').checked = true;
}

function searchUser(button)
{
	var f = button.form;
	var field = '';
	if(DOM.firstChild(DOM.prev(f.id.parentNode, "TD"), 'INPUT').checked) field = 'id';
	if(DOM.firstChild(DOM.prev(f.fio.parentNode, "TD"), 'INPUT').checked) field = 'fio';
	if(DOM.firstChild(DOM.prev(f.email.parentNode, "TD"), 'INPUT').checked) field = 'email';
	if(field && f[field].value)
	{
		$.ajax({
			url: base_url + 'ajax/get_user_des/',
			type: 'POST',
			data: {
				field:field,
				value: f[field].value
			},
			success: function(data)
			{						
				if(data)
				{
					var data_arr = data.split('/');
					f.id.value = data_arr[0];
					f.fio.value = data_arr[1];
					f.email.value = data_arr[2];
					setDisabledSubmit();
				}
			}
		});
	}
}

function setDisabledSubmit()
{
	var f = document.getElementById('f');
	f.subm.disabled = f.id.value == '' || f.password.value == '';
}

function cleanInput(field)
{
	var f = document.getElementById('f');
	if(field != 'id') f.id.value = '';
	if(field != 'fio') f.fio.value = '';
	if(field != 'email') f.email.value = '';
}
